package com.slz3.business.module.memberManagement.memShippingAddress.service;

import com.slz3.business.frame.module.Repositorys;
import com.slz3.business.module.memberManagement.memShippingAddress.domain.MemShippingAddress;
import com.slz3.business.module.memberManagement.memShippingAddress.domain.MemShippingAddressFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.time.LocalDateTime;
import java.util.List;

@Slf4j
@Service
public class MemShippingAddressTransactionalServiceImpl implements MemShippingAddressTransactionalService {

    @Override
    public MemShippingAddress modify(MemShippingAddress memShippingAddressNew) {
        Repositorys.memShippingAddress.test();
        Repositorys.memShippingAddress.save(MemShippingAddressFactory.initBaseFields());
        System.err.println(1/0);
        memShippingAddressNew.setLastModifyTime(LocalDateTime.now());
        return Repositorys.memShippingAddress.saveAndFlush(memShippingAddressNew);
    }

    @Override
    public List<MemShippingAddress> batchModify(List<MemShippingAddress> memShippingAddressList) {
        return Repositorys.memShippingAddress.saveAll(memShippingAddressList);
    }
}
